﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kardex_DataAccess;
using Kardex_Entity;

namespace Kardex_BussinesLogic
{
    public class SucursalFactory
    {
        SucursalDA manager;
        public SucursalFactory()
        {
            manager = new SucursalDA();
        }
        public List<sucursal> GetListAllByIdPerson(long Iderson)
        {
            List<sucursal> listManager = new List<sucursal>();
            listManager = null;
            try
            {
                listManager = manager.GetListAllByIdPerson(Iderson);
            }
            catch (Exception)
            {
                listManager = null;
            }
            return listManager;
        }
        public sucursal GetObjByIdSucursal(int IdSucursal)
        {
            return manager.GetObjByIdSucursal(IdSucursal);
        }

        public sucursal Save(sucursal objSucursal)
        {
            try
            {
                return manager.Save(objSucursal);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        public bool Update(sucursal objSucursal)
        {
            try
            {
                return manager.Udate(objSucursal);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        public bool Delete(sucursal objSucursal)
        {
            try
            {
                return manager.Delete(objSucursal);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

    }
}
